/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fait.ferm.ui;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.layout.StackPane;

/**
 *
 * @author alex
 */
public class FermOverviewController implements Initializable{
//	@FXML 
//	private LineChart<Number, Number> chrt;
	@FXML 
	private StackPane chartStack;

	private LineChart<String, Number> chrt;
	final NumberAxis yAxis = new NumberAxis();
        final CategoryAxis xAxis = new CategoryAxis();
	
	@Override
	public void initialize(URL url, ResourceBundle rb) {
		fillChart();
	}
	
	public void fillChart(){
		//TODO загрузить реальные данные
		chrt = new LineChart<>(xAxis,yAxis);
		xAxis.setLabel("Месяцы");
		XYChart.Series series = new XYChart.Series();
		series.setName("Рентабельность производства");
		
		//populating the series with data
		series.getData().add(new XYChart.Data("Янв", -23));
		series.getData().add(new XYChart.Data("Фев", -14));
		series.getData().add(new XYChart.Data("Mар", -5));
		series.getData().add(new XYChart.Data("Aпр", 0));
		series.getData().add(new XYChart.Data("Maй", 4));
		series.getData().add(new XYChart.Data("Июн", 6));
		series.getData().add(new XYChart.Data("Июл", 2));
		series.getData().add(new XYChart.Data("Авг", 5));
		series.getData().add(new XYChart.Data("Сен", 13));
		chrt.getData().add(series);
		chartStack.getChildren().add(chrt);
		
		
	}
	
}
